/**
* Copyright (c) 2016-2100 yunclouds
*/
package com.yunqian.redot.service;

import com.yunqian.redot.domain.Code;
import com.yunqian.redot.repository.CodeRepository;
import com.yunqian.service.BaseService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author czy
 * 2018-10-25 18:40:35
 */
@Log4j2
@Service
public class CodeService extends BaseService<Code, Long> {

    @Autowired
    private CodeRepository codeRepository;

    public Code getFirstByPhone(String phone){
        return codeRepository.findTopByPhoneOrderBySaveTimeDesc(phone);
    }

}
